package javase.reflection.spies;

import java.lang.reflect.Constructor;

import javase.reflection.Specific;

public class ConstructorSpy {
	
	public static void main(String[] args) {
		ConstructorSpy spy = new ConstructorSpy();
		Object object = new Specific();
		
		spy.printPublicConstructor(object.getClass());
		spy.printDeclaredConstructor(object.getClass());
	}
	
	private void printPublicConstructor(Class<?> clazz) {
		System.out.println("class.getConstructors: ");
		printConstructors(clazz.getConstructors());
	}
	
	private void printDeclaredConstructor(Class<?> clazz) {
		System.out.println("class.getDeclaredConstructors: ");
		printConstructors(clazz.getDeclaredConstructors());
//		clazz.getd
	}
	
	private void printConstructors(Constructor<?> [] constructors) {
		for (Constructor<?> constructor : constructors) {
			System.out.println(constructor.toGenericString());
		}
		System.out.println("");
	}
}
